Referential integrity in a relational database is consistency between coupled tables. Referential integrity is usually enforced by the combination of a primary key or candidate key and a foreign key. For referential integrity to hold, any field in a table that is declared a foreign key can contain only values from a parent table's primary key or a candidate key. For instance, deleting a record that contains a value referred to by a foreign key in another table would break referential integrity. The relational database management system (RDBMS) enforces referential integrity, normally either by deleting the foreign key rows as well to maintain integrity, or by returning an error and not performing the delete. Which method is used would be defined by the definition of the referential integrity constraint.
In the context of a directory server, such as a Light Weight Directory Access Protocol (LDAP), referential integrity can fail for multi-master replication scenarios. A master server may have replication agreements with other connected master servers. In such a replicated system, an attempt to add a reference that points to an entry that does not exist on the local server will fail, even when that entry has been added in another server but has yet not been replicated to the local server. Another problem with such a system is that not all master servers are in direct communication with each other. A delay or timing issue may arise as a result of such indirect connection. One solution to preventing such a referential integrity failure is to lock down the network to propagate any necessary changes. However, locking the network presents many disadvantages such as introducing further delay and down time.